<template>
    <div
        class="page_root"
        :key="queryUpdateFlag"
        data-page-name="企业新建-详情-编辑"
        data-page-identification="r_h428mpybdj"
    >
        <a-spin :spinning="pageLoading.loading" :tip="pageLoading.tip">
            <!-- begin vid_7hclht4lf1 自定义模板_t9qsnxu55x -->
            <!--            编辑关键信息-->
            <a-drawer
                :title="state.informationEditTitle"
                placement="right"
                width="820px"
                :mask-closable="true"
                :visible="state.informationEditVisible"
                @close="cancelDrawer"
                :body-style="{
                    paddingBottom: '0'
                }"
            >
                <div class="drawer-body">
                    <div class="drawer-main">
                        <div class="tip mg16">{{ state.editType }}-编辑</div>
                        <a-form
                            :model="state.customData"
                            ref="custonRef"
                            v-if="state.editType === '客户画像'"
                            layout="vertical"
                        >
                            <a-row :gutter="24">
                                <!--                                    决策信息-->
                                <a-col :span="24">
                                    <div class="bottom-tip deep-font mg16 flex"
                                        ><div> 决策层级 </div
                                        ><a-button type="link" @click="handleAddDecision">
                                            <template #icon><PlusOutlined /></template>
                                            添加</a-button
                                        ></div
                                    >
                                </a-col>
                                <a-col :span="24">
                                    <div
                                        class="son-item"
                                        v-for="(item, index) in state.modalForm.decisionLevelList"
                                        :key="index"
                                    >
                                        <a-row :gutter="8">
                                            <a-col :span="11" class="gray-bgc mg8">
                                                <a-form-item
                                                    label="阶段"
                                                    :name="['decisionLevelList', index, 'stage']"
                                                    :rules="[{ required: true, message: '请选择', trigger: 'blur' }]"
                                                >
                                                    <a-select
                                                        :options="state.stageList"
                                                        v-model:value="state.modalForm.decisionLevelList[index].stage"
                                                        :placeholder="selectHolder"
                                                        show-search
                                                        :filter-option="
                                                            (input, option) => {
                                                                return (
                                                                    option.label
                                                                        .toLowerCase()
                                                                        .indexOf(input.toLowerCase()) >= 0
                                                                )
                                                            }
                                                        "
                                                    />
                                                </a-form-item>
                                            </a-col>
                                            <a-col :span="11" class="gray-bgc mg8">
                                                <a-form-item
                                                    label="最高层级"
                                                    :name="['decisionLevelList', index, 'highLevel']"
                                                    :rules="[{ required: true, message: '请选择', trigger: 'blur' }]"
                                                >
                                                    <a-select
                                                        :options="state.levelList"
                                                        v-model:value="
                                                            state.modalForm.decisionLevelList[index].highLevel
                                                        "
                                                        :placeholder="selectHolder"
                                                        show-search
                                                        :filter-option="
                                                            (input, option) => {
                                                                return (
                                                                    option.label
                                                                        .toLowerCase()
                                                                        .indexOf(input.toLowerCase()) >= 0
                                                                )
                                                            }
                                                        "
                                                    />
                                                </a-form-item>
                                            </a-col>
                                            <a-col
                                                :span="2"
                                                class="gray-bgc"
                                                style="display: flex; align-items: center"
                                            >
                                                <MinusCircleOutlined
                                                    style="cursor: pointer; color: #3875ff"
                                                    @click="handleDeleteDecision(index)"
                                                />
                                            </a-col>
                                        </a-row>
                                    </div>
                                </a-col>
                                <!--                                    决策信息-->
                            </a-row>
                        </a-form>
                        <a-form :model="state.modalForm" ref="formRef" layout="vertical" v-else>
                            <template v-if="state.editType === '关键信息'">
                                <a-row :gutter="24">
                                    <a-col :span="12">
                                        <a-form-item
                                            label="工厂名称"
                                            :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                            name="factoryName"
                                        >
                                            <a-input
                                                :placeholder="inputHolder"
                                                v-model:value="state.modalForm.factoryName"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="12">
                                        <a-form-item
                                            label="工厂简称"
                                            :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                            name="factoryShortName"
                                        >
                                            <a-input
                                                :placeholder="inputHolder"
                                                v-model:value="state.modalForm.factoryShortName"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="12">
                                        <a-form-item
                                            label="客成经理"
                                            :rules="[
                                                {
                                                    required: true,
                                                    message: '请选择',
                                                    trigger: ['blur', 'change']
                                                }
                                            ]"
                                            name="customerManager"
                                        >
                                            <a-select
                                                :options="state.allUser"
                                                show-search
                                                :filter-option="
                                                    (input, option) => {
                                                        return (
                                                            option.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                        )
                                                    }
                                                "
                                                :field-names="{ label: 'name', value: 'name' }"
                                                :placeholder="selectHolder"
                                                v-model:value="state.modalForm.customerManager"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-divider style="margin: 0 0 16px 0; background-color: #3875ff" />
                                    <a-col :span="24">
                                        <a-form-item
                                            label="信息化程度先进度"
                                            :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                            name="informationDegree"
                                        >
                                            <a-input
                                                :placeholder="inputHolder"
                                                v-model:value="state.modalForm.informationDegree"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="24">
                                        <a-form-item
                                            label="判断企业拥抱数智化程度，辨别竞品和竞争者"
                                            :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                            name="digitizationDegree"
                                        >
                                            <a-input
                                                :placeholder="inputHolder"
                                                v-model:value="state.modalForm.digitizationDegree"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="24">
                                        <a-form-item
                                            label="设备自动化程度稳定度"
                                            :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                            name="deviceAutomationStabilityDegree"
                                        >
                                            <a-input
                                                :placeholder="inputHolder"
                                                v-model:value="state.modalForm.deviceAutomationStabilityDegree"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    {{ state.modalForm.productLineList }}
                                </a-row>
                                <a-col :span="24">
                                    <div class="bottom-tip deep-font mg16 flex"
                                        ><div> 生产线 </div
                                        ><a-button type="link" @click="handleAddProductLine">
                                            <template #icon><PlusOutlined /></template>
                                            添加</a-button
                                        ></div
                                    >
                                </a-col>
                                <div
                                    class="son-item"
                                    v-for="(item, index) in state.modalForm.productLineList"
                                    :key="index"
                                >
                                    <a-row :gutter="8">
                                        <a-col :span="23" class="gray-bgc mg8">
                                            <a-form-item
                                                label=""
                                                :name="['productLineList', index]"
                                                :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                            >
                                                <a-input
                                                    :placeholder="inputHolder"
                                                    v-model:value="state.modalForm.productLineList[index]"
                                                />
                                            </a-form-item>
                                        </a-col>

                                        <a-col :span="1" class="gray-bgc" style="display: flex; align-items: start">
                                            <MinusCircleOutlined
                                                style="cursor: pointer; color: #3875ff"
                                                @click="handleDeleteProductLine(index)"
                                            />
                                        </a-col>
                                    </a-row>
                                </div>
                                <a-row :gutter="24">
                                    <a-col :span="24">
                                        <a-form-item
                                            label="管理精细化程度"
                                            :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                            name="refinedManagement"
                                        >
                                            <a-input
                                                :placeholder="inputHolder"
                                                v-model:value="state.modalForm.refinedManagement"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="24">
                                        <a-form-item
                                            label="判断企业需求数智化程度"
                                            :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                            name="digitizationNeeds"
                                        >
                                            <a-input
                                                :placeholder="inputHolder"
                                                v-model:value="state.modalForm.digitizationNeeds"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="24">
                                        <a-form-item
                                            label="产能"
                                            :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                            name="capacity"
                                        >
                                            <a-input
                                                :placeholder="inputHolder"
                                                v-model:value="state.modalForm.capacity"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="24">
                                        <a-form-item
                                            label="利税"
                                            :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                            name="profitTax"
                                        >
                                            <a-input
                                                :placeholder="inputHolder"
                                                v-model:value="state.modalForm.profitTax"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="24">
                                        <a-form-item
                                            label="市场份额"
                                            :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                            name="marketShare"
                                        >
                                            <a-input
                                                :placeholder="inputHolder"
                                                v-model:value="state.modalForm.marketShare"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="24">
                                        <a-form-item
                                            label="判断企业效益支撑数智化程度"
                                            :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                            name="profitDigitization"
                                        >
                                            <a-input
                                                :placeholder="inputHolder"
                                                v-model:value="state.modalForm.profitDigitization"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-divider style="margin: 0 0 16px 0; background-color: #3875ff" />
                                    <a-col :span="24">
                                        <a-form-item
                                            label="国家级奖项驱动"
                                            :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                            name="nationRewardDrive"
                                        >
                                            <a-input
                                                :placeholder="inputHolder"
                                                v-model:value="state.modalForm.nationRewardDrive"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="24">
                                        <a-form-item
                                            label="业内影响力"
                                            :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                            name="industryInfluence"
                                        >
                                            <a-input
                                                :placeholder="inputHolder"
                                                v-model:value="state.modalForm.industryInfluence"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="24">
                                        <a-form-item
                                            label="判断企业拥抱数智化程度，辨别阻碍"
                                            :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                            name="hugDigitizationDegree"
                                        >
                                            <a-input
                                                :placeholder="inputHolder"
                                                v-model:value="state.modalForm.hugDigitizationDegree"
                                            />
                                        </a-form-item>
                                    </a-col>
                                </a-row>
                            </template>
                            <template v-if="state.editType === '基础信息'">
                                <a-row :gutter="24">
                                    <a-col :span="12">
                                        <a-form-item
                                            label="企业性质"
                                            :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                            name="basicEnterpriseNature"
                                        >
                                            <a-select
                                                :options="state.xzList"
                                                v-model:value="state.modalForm.basicEnterpriseNature"
                                                :placeholder="selectHolder"
                                                show-search
                                                :filter-option="
                                                    (input, option) => {
                                                        return (
                                                            option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                        )
                                                    }
                                                "
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="12">
                                        <a-form-item
                                            label="企业位置"
                                            :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                            name="basicEnterpriseLocation"
                                        >
                                            <a-tree-select
                                                v-model:value="state.modalForm.basicEnterpriseLocation"
                                                allowClear
                                                showSearch
                                                :placeholder="selectHolder"
                                                tree-default-expand-all
                                                :tree-data="state.wzList"
                                                :field-names="{ label: 'label', value: 'label' }"
                                                :filter-option="
                                                    (input, option) => {
                                                        return (
                                                            option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                        )
                                                    }
                                                "
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="24">
                                        <a-form-item
                                            label="员工规模"
                                            :rules="[
                                                {
                                                    required: true,
                                                    message: '请输入',
                                                    trigger: ['blur', 'change']
                                                }
                                            ]"
                                            name="basicEnterpriseEployee"
                                        >
                                            <a-input
                                                :placeholder="inputHolder"
                                                v-model:value="state.modalForm.basicEnterpriseEployee"
                                            />
                                        </a-form-item>
                                    </a-col>

                                    <a-col :span="24">
                                        <a-form-item name="departmentImageList" label="组织架构">
                                            <a-upload
                                                v-model:file-list="state.modalForm.departmentImageList"
                                                :multiple="true"
                                                :before-upload="handlerUpload"
                                                @remove="handlerRemove"
                                                accept=".xlsx, image/*,.docx,, .xls,.mp4"
                                            >
                                                <a-button type="primary">
                                                    <upload-outlined />
                                                    上传
                                                </a-button>
                                            </a-upload>
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="24">
                                        <a-form-item
                                            label="企业级别"
                                            :rules="[
                                                {
                                                    required: true,
                                                    message: '请输入',
                                                    trigger: ['blur', 'change']
                                                }
                                            ]"
                                            name="basicEnterpriseEployee"
                                        >
                                            <a-select
                                                :options="state.jbList"
                                                v-model:value="state.modalForm.basicPositionLevel"
                                                :placeholder="selectHolder"
                                                show-search
                                                :filter-option="
                                                    (input, option) => {
                                                        return (
                                                            option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                        )
                                                    }
                                                "
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="24">
                                        <div class="bottom-tip deep-font mg16 flex"
                                            ><div> 股东信息 </div
                                            ><a-button type="link" @click="handleAddShareholde">
                                                <template #icon><PlusOutlined /></template>
                                                添加</a-button
                                            ></div
                                        >
                                    </a-col>
                                    <a-col :span="24">
                                        <div
                                            class="son-item"
                                            v-for="(item, index) in state.modalForm.shareholderList"
                                            :key="index"
                                        >
                                            <a-row :gutter="8">
                                                <a-col :span="11" class="gray-bgc mg8">
                                                    <a-form-item label="股东名称">
                                                        <a-input
                                                            :placeholder="inputHolder"
                                                            v-model:value="state.modalForm.shareholderList[index].name"
                                                        />
                                                    </a-form-item>
                                                </a-col>
                                                <a-col :span="11" class="gray-bgc mg8">
                                                    <a-form-item label="股比">
                                                        <a-input
                                                            :placeholder="inputHolder"
                                                            v-model:value="
                                                                state.modalForm.shareholderList[index].proportion
                                                            "
                                                        />
                                                    </a-form-item>
                                                </a-col>
                                                <a-col
                                                    :span="2"
                                                    class="gray-bgc"
                                                    style="display: flex; align-items: center"
                                                >
                                                    <MinusCircleOutlined
                                                        style="cursor: pointer; color: #3875ff"
                                                        @click="handleDeleteShareholde(index)"
                                                    />
                                                </a-col>
                                            </a-row>
                                        </div>
                                    </a-col>
                                    <a-col :span="24">
                                        <a-form-item label="企业位置城市级别">
                                            <a-select
                                                :options="state.csjbList"
                                                v-model:value="state.modalForm.basicEnterpriseLocationDetail"
                                                :placeholder="selectHolder"
                                                show-search
                                                :filter-option="
                                                    (input, option) => {
                                                        return (
                                                            option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                        )
                                                    }
                                                "
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="24">
                                        <a-form-item label="注册地址">
                                            <a-input
                                                :placeholder="inputHolder"
                                                v-model:value="state.modalForm.basicEnterpriseRegisterAddress"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="24">
                                        <a-form-item label="成立时间">
                                            <a-date-picker
                                                valueFormat="YYYY-MM-DD"
                                                v-model:value="state.modalForm.basicEnterpriseEstablishDate"
                                                :placeholder="selectHolder"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="24">
                                        <a-form-item label="企业法人">
                                            <a-input
                                                :placeholder="inputHolder"
                                                v-model:value="state.modalForm.basicEnterpriseLegalPerson"
                                            />
                                        </a-form-item>
                                    </a-col>
                                </a-row>
                            </template>
                            <template v-if="state.editType === '经营信息'">
                                <a-row :gutter="24">
                                    <!--                                    主营产品-->
                                    <a-col :span="24">
                                        <div class="bottom-tip deep-font mg16 flex"
                                            ><div> 主营产品及占比 </div
                                            ><a-button type="link" @click="handleAddOperate">
                                                <template #icon><PlusOutlined /></template>
                                                添加</a-button
                                            ></div
                                        >
                                    </a-col>
                                    <a-col :span="24">
                                        <div
                                            class="son-item"
                                            v-for="(item, index) in state.modalForm.operateProductsProportionList"
                                            :key="index"
                                        >
                                            <a-row :gutter="8">
                                                <a-col :span="11" class="gray-bgc mg8">
                                                    <a-form-item
                                                        label="产品名称"
                                                        :name="[
                                                            'operateProductsProportionList',
                                                            index,
                                                            'softwareSystemCategory'
                                                        ]"
                                                        :rules="[
                                                            { required: true, message: '请选择', trigger: 'blur' }
                                                        ]"
                                                    >
                                                        <a-select
                                                            :options="state.softList"
                                                            v-model:value="
                                                                state.modalForm.operateProductsProportionList[index]
                                                                    .softwareSystemCategory
                                                            "
                                                            :placeholder="selectHolder"
                                                            show-search
                                                            :filter-option="
                                                                (input, option) => {
                                                                    return (
                                                                        option.label
                                                                            .toLowerCase()
                                                                            .indexOf(input.toLowerCase()) >= 0
                                                                    )
                                                                }
                                                            "
                                                        />
                                                    </a-form-item>
                                                </a-col>
                                                <a-col :span="11" class="gray-bgc mg8">
                                                    <a-form-item
                                                        label="占比"
                                                        :name="['operateProductsProportionList', index, 'ratio']"
                                                        :rules="[
                                                            { required: true, message: '请输入', trigger: 'blur' }
                                                        ]"
                                                    >
                                                        <a-input-number
                                                            placeholder="请输入正数"
                                                            min="0"
                                                            step="1"
                                                            v-model:value="
                                                                state.modalForm.operateProductsProportionList[index]
                                                                    .ratio
                                                            "
                                                        />
                                                    </a-form-item>
                                                </a-col>
                                                <a-col
                                                    :span="2"
                                                    class="gray-bgc"
                                                    style="display: flex; align-items: center"
                                                >
                                                    <MinusCircleOutlined
                                                        style="cursor: pointer; color: #3875ff"
                                                        @click="handleDeleteOperate(index)"
                                                    />
                                                </a-col>
                                            </a-row>
                                        </div>
                                    </a-col>
                                    <!--                                    主营产品-->
                                    <!--                                    经营指标-->
                                    <a-col :span="24">
                                        <div class="bottom-tip deep-font mg16 flex"
                                            ><div> 经营指标 </div
                                            ><a-button type="link" @click="handleAddMetrics">
                                                <template #icon><PlusOutlined /></template>
                                                添加</a-button
                                            ></div
                                        >
                                    </a-col>
                                    <a-col :span="24">
                                        <div
                                            class="son-item"
                                            v-for="(item, index) in state.modalForm.operateOperateMetricsList"
                                            :key="index"
                                        >
                                            <a-row :gutter="8">
                                                <a-col :span="10" class="gray-bgc mg8">
                                                    <a-form-item
                                                        label="主营业务收入"
                                                        :name="['operateOperateMetricsList', index, 'income']"
                                                        :rules="[
                                                            { required: true, message: '请输入', trigger: 'blur' }
                                                        ]"
                                                    >
                                                        <a-input-number
                                                            placeholder="请输入正数"
                                                            min="0"
                                                            step="1"
                                                            v-model:value="
                                                                state.modalForm.operateOperateMetricsList[index].income
                                                            "
                                                        />
                                                    </a-form-item>
                                                </a-col>
                                                <a-col :span="6" class="gray-bgc mg8">
                                                    <a-form-item
                                                        label="毛利"
                                                        :name="['operateOperateMetricsList', index, 'grossMargin']"
                                                        :rules="[
                                                            { required: true, message: '请输入', trigger: 'blur' }
                                                        ]"
                                                    >
                                                        <a-input-number
                                                            placeholder="请输入正数"
                                                            min="0"
                                                            step="1"
                                                            v-model:value="
                                                                state.modalForm.operateOperateMetricsList[index]
                                                                    .grossMargin
                                                            "
                                                        />
                                                    </a-form-item>
                                                </a-col>
                                                <a-col :span="6" class="gray-bgc mg8">
                                                    <a-form-item
                                                        label="区域市场份额排名"
                                                        :name="['operateOperateMetricsList', index, 'areaMarketRank']"
                                                        :rules="[
                                                            { required: true, message: '请输入', trigger: 'blur' }
                                                        ]"
                                                    >
                                                        <a-input-number
                                                            placeholder="请输入正数"
                                                            min="0"
                                                            step="1"
                                                            v-model:value="
                                                                state.modalForm.operateOperateMetricsList[index]
                                                                    .areaMarketRank
                                                            "
                                                        />
                                                    </a-form-item>
                                                </a-col>
                                                <a-col
                                                    :span="2"
                                                    class="gray-bgc"
                                                    style="display: flex; align-items: center"
                                                >
                                                    <MinusCircleOutlined
                                                        style="cursor: pointer; color: #3875ff"
                                                        @click="handleDeleteMetrics(index)"
                                                    />
                                                </a-col>
                                            </a-row>
                                        </div>
                                    </a-col>
                                    <!--                                    经营指标-->
                                    <a-col :span="24">
                                        <div class="bottom-tip deep-font mg16 flex"><div> 产能指标 </div></div>
                                    </a-col>
                                    <a-col :span="12">
                                        <a-form-item
                                            label="产量"
                                            :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                            :name="['capacityMetrics', 'production']"
                                        >
                                            <a-input-number
                                                placeholder="请输入正数"
                                                min="0"
                                                step="1"
                                                v-model:value="state.modalForm.capacityMetrics.production"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="12">
                                        <a-form-item
                                            label="销量"
                                            :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                            :name="['capacityMetrics', 'salesVolume']"
                                        >
                                            <a-input-number
                                                placeholder="请输入正数"
                                                min="0"
                                                step="1"
                                                v-model:value="state.modalForm.capacityMetrics.salesVolume"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="24">
                                        <a-form-item
                                            label="产品品种"
                                            :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                            name="operateProducctVariety"
                                        >
                                            <a-input
                                                :placeholder="inputHolder"
                                                v-model:value="state.modalForm.capacityMetrics.operateProducctVariety"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="24">
                                        <a-form-item
                                            label="特殊要求(品质等)"
                                            :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                            name="operateSpecilalNeeds"
                                        >
                                            <a-input
                                                :placeholder="inputHolder"
                                                v-model:value="state.modalForm.capacityMetrics.operateSpecilalNeeds"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="24">
                                        <a-form-item label="销售覆盖范围">
                                            <a-select
                                                :options="state.fgList"
                                                v-model:value="state.modalForm.operateSaleRange"
                                                :placeholder="selectHolder"
                                                show-search
                                                :filter-option="
                                                    (input, option) => {
                                                        return (
                                                            option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                        )
                                                    }
                                                "
                                            />
                                        </a-form-item>
                                    </a-col>
                                </a-row>
                            </template>
                            <template v-if="state.editType === '生产类信息'">
                                <a-row :gutter="24">
                                    <!--                                    控制系统-->
                                    <a-col :span="24">
                                        <div class="bottom-tip deep-font mg16 flex"
                                            ><div> 主营产品及占比 </div
                                            ><a-button type="link" @click="handleAddControl">
                                                <template #icon><PlusOutlined /></template>
                                                添加</a-button
                                            ></div
                                        >
                                    </a-col>
                                    <a-col :span="24">
                                        <div
                                            class="son-item"
                                            v-for="(item, index) in state.modalForm.controlSystemList"
                                            :key="index"
                                        >
                                            <a-row :gutter="8">
                                                <a-col :span="7" class="gray-bgc mg8">
                                                    <a-form-item
                                                        label="控制系统"
                                                        :name="['controlSystemList', index, 'controlSystem']"
                                                        :rules="[
                                                            { required: true, message: '请选择', trigger: 'blur' }
                                                        ]"
                                                    >
                                                        <a-select
                                                            :options="state.scsbList"
                                                            v-model:value="
                                                                state.modalForm.controlSystemList[index].controlSystem
                                                            "
                                                            :placeholder="selectHolder"
                                                            show-search
                                                            :filter-option="
                                                                (input, option) => {
                                                                    return (
                                                                        option.label
                                                                            .toLowerCase()
                                                                            .indexOf(input.toLowerCase()) >= 0
                                                                    )
                                                                }
                                                            "
                                                        />
                                                    </a-form-item>
                                                </a-col>
                                                <a-col :span="5" class="gray-bgc mg8">
                                                    <a-form-item
                                                        label="系统厂家"
                                                        :name="['controlSystemList', index, 'systemSource']"
                                                        :rules="[
                                                            { required: true, message: '请输入', trigger: 'blur' }
                                                        ]"
                                                    >
                                                        <a-input
                                                            :placeholder="inputHolder"
                                                            v-model:value="
                                                                state.modalForm.controlSystemList[index].systemSource
                                                            "
                                                        />
                                                    </a-form-item>
                                                </a-col>
                                                <a-col :span="5" class="gray-bgc mg8">
                                                    <a-form-item
                                                        label="采购时间"
                                                        :name="['controlSystemList', index, 'buyTime']"
                                                        :rules="[
                                                            { required: true, message: '请选择', trigger: 'blur' }
                                                        ]"
                                                    >
                                                        <a-date-picker
                                                            valueFormat="YYYY-MM-DD"
                                                            v-model:value="
                                                                state.modalForm.controlSystemList[index].buyTime
                                                            "
                                                            :placeholder="selectHolder"
                                                        />
                                                    </a-form-item>
                                                </a-col>
                                                <a-col :span="5" class="gray-bgc mg8">
                                                    <a-form-item
                                                        label="历史偏差率"
                                                        :name="['controlSystemList', index, 'historyDeviation']"
                                                        :rules="[
                                                            { required: true, message: '请输入', trigger: 'blur' }
                                                        ]"
                                                    >
                                                        <a-input-number
                                                            :olaceholder="inputHolder"
                                                            v-model:value="
                                                                state.modalForm.controlSystemList[index]
                                                                    .historyDeviation
                                                            "
                                                        />
                                                    </a-form-item>
                                                </a-col>
                                                <a-col
                                                    :span="2"
                                                    class="gray-bgc"
                                                    style="display: flex; align-items: center"
                                                >
                                                    <MinusCircleOutlined
                                                        style="cursor: pointer; color: #3875ff"
                                                        @click="handleDeleteControl(index)"
                                                    />
                                                </a-col>
                                            </a-row>
                                        </div>
                                    </a-col>
                                    <!--                                    控制系统-->
                                    <!--                                    自动化设备-->
                                    <a-col :span="24">
                                        <div class="bottom-tip deep-font mg16 flex"
                                            ><div> 经营指标 </div
                                            ><a-button type="link" @click="handleAddAuto">
                                                <template #icon><PlusOutlined /></template>
                                                添加</a-button
                                            ></div
                                        >
                                    </a-col>
                                    <a-col :span="24">
                                        <div
                                            class="son-item"
                                            v-for="(item, index) in state.modalForm.automationDeviceList"
                                            :key="index"
                                        >
                                            <a-row :gutter="8">
                                                <a-col :span="7" class="gray-bgc mg8">
                                                    <a-form-item
                                                        label="生产设备"
                                                        :name="['automationDeviceList', index, 'productionDeviceName']"
                                                        :rules="[
                                                            { required: true, message: '请选择', trigger: 'blur' }
                                                        ]"
                                                    >
                                                        <a-select
                                                            :options="state.scsbList"
                                                            v-model:value="
                                                                state.modalForm.automationDeviceList[index]
                                                                    .productionDeviceName
                                                            "
                                                            :placeholder="selectHolder"
                                                            show-search
                                                            :filter-option="
                                                                (input, option) => {
                                                                    return (
                                                                        option.label
                                                                            .toLowerCase()
                                                                            .indexOf(input.toLowerCase()) >= 0
                                                                    )
                                                                }
                                                            "
                                                        />
                                                    </a-form-item>
                                                </a-col>
                                                <a-col :span="5" class="gray-bgc mg8">
                                                    <a-form-item
                                                        label="设备厂家"
                                                        :name="[
                                                            'automationDeviceList',
                                                            index,
                                                            'deviceManufacturerName'
                                                        ]"
                                                        :rules="[
                                                            { required: true, message: '请输入', trigger: 'blur' }
                                                        ]"
                                                    >
                                                        <a-input
                                                            :placeholder="inputHolder"
                                                            v-model:value="
                                                                state.modalForm.automationDeviceList[index]
                                                                    .deviceManufacturerName
                                                            "
                                                        />
                                                    </a-form-item>
                                                </a-col>
                                                <a-col :span="5" class="gray-bgc mg8">
                                                    <a-form-item
                                                        label="采购时间"
                                                        :name="['automationDeviceList', index, 'buyTime']"
                                                        :rules="[
                                                            { required: true, message: '请选择', trigger: 'blur' }
                                                        ]"
                                                    >
                                                        <a-date-picker
                                                            valueFormat="YYYY-MM-DD"
                                                            v-model:value="
                                                                state.modalForm.automationDeviceList[index].buyTime
                                                            "
                                                            :placeholder="selectHolder"
                                                        />
                                                    </a-form-item>
                                                </a-col>
                                                <a-col :span="5" class="gray-bgc mg8">
                                                    <a-form-item
                                                        label="历史偏差率"
                                                        :name="['automationDeviceList', index, 'historyDeviation']"
                                                        :rules="[
                                                            { required: true, message: '请输入', trigger: 'blur' }
                                                        ]"
                                                    >
                                                        <a-input-number
                                                            :olaceholder="inputHolder"
                                                            v-model:value="
                                                                state.modalForm.automationDeviceList[index]
                                                                    .historyDeviation
                                                            "
                                                        />
                                                    </a-form-item>
                                                </a-col>
                                                <a-col
                                                    :span="2"
                                                    class="gray-bgc"
                                                    style="display: flex; align-items: center"
                                                >
                                                    <MinusCircleOutlined
                                                        style="cursor: pointer; color: #3875ff"
                                                        @click="handleDeleteControl(index)"
                                                    />
                                                </a-col>
                                            </a-row>
                                        </div>
                                    </a-col>
                                    <!--                                    自动化设备-->
                                </a-row>
                            </template>
                            <template v-if="state.editType === '信息化信息'">
                                <a-row :gutter="24">
                                    <a-col :span="12">
                                        <a-form-item
                                            label="企业在用信息化系统数量（个）"
                                            :rules="[
                                                { required: true, message: '请输入', trigger: 'blur' },
                                                { validator: validatePositiveInteger, trigger: ['blur', 'change'] }
                                            ]"
                                            name="informationSystemNumber"
                                        >
                                            <a-input-number
                                                min="0"
                                                step="1"
                                                placeholder="请输入正整数"
                                                v-model:value="state.modalForm.informationSystemNumber"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="12">
                                        <a-form-item
                                            label="企业近3年申报信息化奖项数量（个）"
                                            :rules="[
                                                { required: true, message: '请输入', trigger: 'blur' },
                                                { validator: validatePositiveInteger, trigger: ['blur', 'change'] }
                                            ]"
                                            name="informationRewardNumber"
                                        >
                                            <a-input-number
                                                min="0"
                                                step="1"
                                                placeholder="请输入正整数"
                                                v-model:value="state.modalForm.informationRewardNumber"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="12">
                                        <a-form-item
                                            label="企业近3年申请专利软抓数量（个）"
                                            :rules="[
                                                { required: true, message: '请输入', trigger: 'blur' },
                                                { validator: validatePositiveInteger, trigger: ['blur', 'change'] }
                                            ]"
                                            name="informationSoftwareNumber"
                                        >
                                            <a-input-number
                                                min="0"
                                                step="1"
                                                placeholder="请输入正整数"
                                                v-model:value="state.modalForm.informationSoftwareNumber"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="12">
                                        <a-form-item
                                            label="企业近3年合作数智化公司数量（个）"
                                            :rules="[
                                                { required: true, message: '请输入', trigger: 'blur' },
                                                { validator: validatePositiveInteger, trigger: ['blur', 'change'] }
                                            ]"
                                            name="informationCooperateDigitalCompanyNumber"
                                        >
                                            <a-input-number
                                                min="0"
                                                step="1"
                                                placeholder="请输入正整数"
                                                v-model:value="state.modalForm.informationCooperateDigitalCompanyNumber"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="12">
                                        <a-form-item
                                            label="企业近3年投入信息化建设资金金额（万）"
                                            :rules="[
                                                {
                                                    required: true,
                                                    message: '请输入正数',
                                                    trigger: ['blur', 'change']
                                                }
                                            ]"
                                            name="informationEnterpriseDigitalInvestAmount"
                                        >
                                            <a-input-number
                                                min="0"
                                                step="1"
                                                placeholder="请输入正整数"
                                                v-model:value="state.modalForm.informationEnterpriseDigitalInvestAmount"
                                            />
                                        </a-form-item>
                                    </a-col>
                                    <a-col :span="24">
                                        <div class="bottom-tip deep-font mg16 flex"
                                            ><div> 软件系统采购 </div
                                            ><a-button type="link" @click="handleAddSoft">
                                                <template #icon><PlusOutlined /></template>
                                                添加</a-button
                                            ></div
                                        >
                                    </a-col>
                                    <a-col :span="24">
                                        <div
                                            class="son-item"
                                            v-for="(item, index) in state.modalForm.softwareBuyList"
                                            :key="index"
                                        >
                                            <a-row :gutter="8">
                                                <a-col :span="11" class="gray-bgc mg8">
                                                    <a-form-item label="软件系统类型">
                                                        <a-select
                                                            :options="state.softList"
                                                            v-model:value="
                                                                state.modalForm.softwareBuyList[index]
                                                                    .softwareSystemCategory
                                                            "
                                                            :placeholder="selectHolder"
                                                            show-search
                                                            :filter-option="
                                                                (input, option) => {
                                                                    return (
                                                                        option.label
                                                                            .toLowerCase()
                                                                            .indexOf(input.toLowerCase()) >= 0
                                                                    )
                                                                }
                                                            "
                                                        />
                                                    </a-form-item>
                                                </a-col>
                                                <a-col :span="11" class="gray-bgc mg8">
                                                    <a-form-item label="软件系统采购时间">
                                                        <a-date-picker
                                                            valueFormat="YYYY-MM-DD"
                                                            state.modalForm.shareholderList[index].softwareSystemBuyTime
                                                            :placeholder="selectHolder"
                                                        />
                                                    </a-form-item>
                                                </a-col>
                                                <a-col
                                                    :span="2"
                                                    class="gray-bgc"
                                                    style="display: flex; align-items: center"
                                                >
                                                    <MinusCircleOutlined
                                                        style="cursor: pointer; color: #3875ff"
                                                        @click="handleDeleteSoft(index)"
                                                    />
                                                </a-col>
                                            </a-row>
                                        </div>
                                    </a-col>
                                </a-row>
                            </template>
                            <template v-if="state.editType === '决策信息'">
                                <a-row :gutter="24">
                                    <!--                                    决策信息-->
                                    <a-col :span="24">
                                        <div class="bottom-tip deep-font mg16 flex"
                                            ><div> 决策层级 </div
                                            ><a-button type="link" @click="handleAddDecision">
                                                <template #icon><PlusOutlined /></template>
                                                添加</a-button
                                            ></div
                                        >
                                    </a-col>
                                    <a-col :span="24">
                                        <div
                                            class="son-item"
                                            v-for="(item, index) in state.modalForm.decisionLevelList"
                                            :key="index"
                                        >
                                            <a-row :gutter="8">
                                                <a-col :span="11" class="gray-bgc mg8">
                                                    <a-form-item
                                                        label="阶段"
                                                        :name="['decisionLevelList', index, 'stage']"
                                                        :rules="[
                                                            { required: true, message: '请选择', trigger: 'blur' }
                                                        ]"
                                                    >
                                                        <a-select
                                                            :options="state.stageList"
                                                            v-model:value="
                                                                state.modalForm.decisionLevelList[index].stage
                                                            "
                                                            :placeholder="selectHolder"
                                                            show-search
                                                            :filter-option="
                                                                (input, option) => {
                                                                    return (
                                                                        option.label
                                                                            .toLowerCase()
                                                                            .indexOf(input.toLowerCase()) >= 0
                                                                    )
                                                                }
                                                            "
                                                        />
                                                    </a-form-item>
                                                </a-col>
                                                <a-col :span="11" class="gray-bgc mg8">
                                                    <a-form-item
                                                        label="最高层级"
                                                        :name="['decisionLevelList', index, 'highLevel']"
                                                        :rules="[
                                                            { required: true, message: '请选择', trigger: 'blur' }
                                                        ]"
                                                    >
                                                        <a-select
                                                            :options="state.levelList"
                                                            v-model:value="
                                                                state.modalForm.decisionLevelList[index].highLevel
                                                            "
                                                            :placeholder="selectHolder"
                                                            show-search
                                                            :filter-option="
                                                                (input, option) => {
                                                                    return (
                                                                        option.label
                                                                            .toLowerCase()
                                                                            .indexOf(input.toLowerCase()) >= 0
                                                                    )
                                                                }
                                                            "
                                                        />
                                                    </a-form-item>
                                                </a-col>
                                                <a-col
                                                    :span="2"
                                                    class="gray-bgc"
                                                    style="display: flex; align-items: center"
                                                >
                                                    <MinusCircleOutlined
                                                        style="cursor: pointer; color: #3875ff"
                                                        @click="handleDeleteDecision(index)"
                                                    />
                                                </a-col>
                                            </a-row>
                                        </div>
                                    </a-col>
                                    <!--                                    决策信息-->
                                </a-row>
                            </template>
                        </a-form>
                    </div>
                    <div class="bottom-btn" v-if="state.editType === '客户画像'">
                        <a-button
                            type="primary"
                            style="width: 138px"
                            @click="handleSubmitCustom"
                            :loading="state.submitLoading"
                            >保存</a-button
                        >
                    </div>
                    <div class="bottom-btn" v-else>
                        <a-button
                            type="primary"
                            style="width: 138px"
                            @click="handleSubmitFactory"
                            :loading="state.submitLoading"
                            >保存</a-button
                        >
                    </div>
                </div>
            </a-drawer>
            <!--            编辑关键信息-->
            <div class="tab-body">
                <a-tabs v-model:activeKey="state.activeKey" @change="tabChange">
                    <a-tab-pane key="年度政策" tab="年度政策" />
                    <a-tab-pane key="企业画像" tab="企业画像" />
                    <a-tab-pane key="人物画像" tab="人物画像" />
                    <a-tab-pane key="客户画像" tab="客户画像" />
                </a-tabs>
            </div>
            <div class="body">
                <div class="project-body" v-if="state.activeKey === '企业画像'">
                    <!--                    关键信息-->
                    <div class="content mg16">
                        <div class="tip mg16 has-btn">
                            <div> 关键信息 </div>
                            <a-button type="primary" size="small" @click="showEdit('关键信息')">
                                <template #icon><EditOutlined /></template>
                                编辑</a-button
                            >
                        </div>
                        <div
                            class="information-table mg16"
                            style="border-top: none; border-bottom: none; margin-top: 0"
                        >
                            <div class="four-line">
                                <div class="table-title">工厂全称</div>
                                <div class="table-content-four">{{ state.factoryData?.factoryName }}</div>
                                <div class="table-title middle">工厂简称</div>
                                <div class="table-content-four">{{ state.factoryData?.factoryShortName }}</div>
                                <div class="table-title middle">客成经理</div>
                                <div class="table-content-four">{{ state.factoryData?.customerManager }}</div>
                            </div>
                        </div>
                        <div class="deep-font mg4">信息化程度先进度：</div>
                        <div class="content-font mg16">{{ state.factoryData?.informationDegree }}</div>
                        <div class="deep-font mg4">判断企业拥抱数智化程度，辨别竞品和竞争者：</div>
                        <div class="content-font mg16">{{ state.factoryData?.digitizationDegree }}</div>
                        <a-divider style="margin: 16px 0; background-color: #3875ff" />
                        <div class="deep-font mg4">设备自动化程度稳定度：</div>
                        <div class="content-font mg16">{{ state.factoryData?.deviceAutomationStabilityDegree }}</div>
                        <div class="deep-font mg8">生产线：</div>
                        <div class="mg8">
                            <div
                                class="production-line-item mg8 content-font"
                                v-for="(lineItem, lineIndex) in state.factoryData?.productLineList"
                            >
                                {{ lineItem }}
                            </div>
                        </div>
                        <div class="deep-font mg4">管理精细化程度：</div>
                        <div class="content-font mg16">{{ state.factoryData?.refinedManagement }}</div>
                        <div class="deep-font mg4">判断企业需求数智化程度：</div>
                        <div class="content-font mg16">{{ state.factoryData?.digitizationNeeds }}</div>
                        <a-divider style="margin: 16px 0; background-color: #3875ff" />
                        <div class="deep-font mg4">产能：</div>
                        <div class="content-font mg16">{{ state.factoryData?.capacity }}</div>
                        <div class="deep-font mg4">利税：</div>
                        <div class="content-font mg16">{{ state.factoryData?.profitTax }}</div>
                        <div class="deep-font mg4">市场份额：</div>
                        <div class="content-font mg16">{{ state.factoryData?.marketShare }}</div>
                        <div class="deep-font mg4">判断企业效益支撑数智化程度：</div>
                        <div class="content-font mg16">{{ state.factoryData?.profitDigitization }}</div>
                        <div class="deep-font mg4">国家级奖项驱动：</div>
                        <div class="content-font mg16">{{ state.factoryData?.nationRewardDrive }}</div>
                        <div class="deep-font mg4">业内影响力：</div>
                        <div class="content-font mg16">{{ state.factoryData?.industryInfluence }}</div>
                    </div>
                    <!--                    关键信息-->
                    <!--                    底部信息-->
                    <div class="content">
                        <div class="has-btn mg16 radio-body">
                            <a-radio-group v-model:value="state.innerRadio">
                                <a-radio-button value="基本信息">基本信息</a-radio-button>
                                <a-radio-button value="经营信息">经营信息</a-radio-button>
                                <a-radio-button value="生产类信息">生产类信息</a-radio-button>
                                <a-radio-button value="信息化信息">信息化信息</a-radio-button>
                                <a-radio-button value="决策信息">决策信息</a-radio-button>
                            </a-radio-group>
                            <a-button type="primary" size="small" @click="checkEdit">
                                <template #icon><EditOutlined /></template>
                                编辑</a-button
                            >
                        </div>
                        <!--                        基本信息-->
                        <div v-if="state.innerRadio === '基本信息'">
                            <div class="deep-font mg4">企业性质：</div>
                            <div class="content-font mg16">{{ state.factoryData?.basicEnterpriseNature }}</div>
                            <div class="deep-font mg4">企业位置：</div>
                            <div class="content-font mg16">{{ state.factoryData?.basicEnterpriseLocation }}</div>
                            <a-divider style="margin: 16px 0; background-color: #3875ff" />
                            <div class="deep-font mg4">员工规模：</div>
                            <div class="content-font mg16">{{ state.factoryData?.basicEnterpriseEployee }}</div>

                            <div class="deep-font mg4">组织架构：</div>
                            <div class="content-font mg16">
                                <a-image
                                    v-for="(imgItex, imgIndex) in state.factoryData?.departmentImageList"
                                    :width="200"
                                    :src="imgIndex.url"
                                />
                            </div>
                            <div class="deep-font mg4">企业级别：</div>
                            <div class="content-font mg16">{{ state.factoryData?.basicEnterpriseLevel }}</div>
                            <div class="deep-font mg8">股东信息：</div>
                            <div class="mg16">
                                <div
                                    class="shareholder-item mg8 gap72"
                                    v-for="(shareholderItem, shareholderIndex) in state.factoryData?.shareholderList"
                                >
                                    <div class="shareholder-left">
                                        <div class="deep-font">股东名称：</div>
                                        <div class="content-font">{{ shareholderItem.proportion }}</div>
                                    </div>
                                    <div class="shareholder-right">
                                        <div class="deep-font">股比：</div>
                                        <div class="content-font">{{ shareholderItem.proportion }}</div>
                                    </div>
                                </div>
                            </div>
                            <div class="deep-font mg4">企业位置城市级别：</div>
                            <div class="content-font mg16">{{ state.factoryData?.basicEnterpriseLocationDetail }}</div>
                            <div class="deep-font mg4">注册地址：</div>
                            <div class="content-font mg16">{{ state.factoryData?.basicEnterpriseRegisterAddress }}</div>
                            <div class="deep-font mg4">成立时间：</div>
                            <div class="content-font mg16">{{ state.factoryData?.basicEnterpriseEstablishDate }}</div>
                            <div class="deep-font mg4">企业法人：</div>
                            <div class="content-font mg16">{{ state.factoryData?.basicEnterpriseLegalPerson }}</div>
                        </div>
                        <!--                        基本信息-->
                        <!--                        经营信息-->
                        <div v-if="state.innerRadio === '经营信息'">
                            <div class="deep-font mg8">主营产品及占比：</div>
                            <div class="mg16">
                                <div
                                    class="shareholder-item mg8 gap72"
                                    v-for="(mainBusinessItem, mainBusinessIndex) in state.factoryData?.mainBusinessList"
                                >
                                    <div class="shareholder-left">
                                        <div class="deep-font">产品名称：</div>
                                        <div class="content-font">{{ mainBusinessItem.productName }}</div>
                                    </div>
                                    <div class="shareholder-right">
                                        <div class="deep-font">占比：</div>
                                        <div class="content-font">{{ mainBusinessItem.ratio }}</div>
                                    </div>
                                </div>
                            </div>
                            <div class="deep-font mg8">经营指标：</div>
                            <div class="mg16">
                                <div
                                    class="shareholder-item mg8 gap200"
                                    v-for="(operateItem, operateIndex) in state.factoryData?.operateList"
                                >
                                    <div class="shareholder-left">
                                        <div class="deep-font">主营业务收入：</div>
                                        <div class="content-font">{{ operateItem.income }}</div>
                                    </div>
                                    <div class="shareholder-right">
                                        <div class="deep-font">毛利率：</div>
                                        <div class="content-font">{{ operateItem.grossMargin }}</div>
                                    </div>
                                    <div class="shareholder-right">
                                        <div class="deep-font">区域市场份额排名：</div>
                                        <div class="content-font">{{ operateItem.areaMarketRank }}</div>
                                    </div>
                                </div>
                            </div>
                            <div class="deep-font mg8">产能指标：</div>
                            <div class="mg16">
                                <div class="shareholder-item mg8 gap260">
                                    <div class="shareholder-left">
                                        <div class="deep-font">产量：</div>
                                        <div class="content-font">{{
                                            state.factoryData?.capacityMetrics.production
                                        }}</div>
                                    </div>
                                    <div class="shareholder-right">
                                        <div class="deep-font">销量：</div>
                                        <div class="content-font">{{
                                            state.factoryData?.capacityMetrics.salesVolume
                                        }}</div>
                                    </div>
                                </div>
                            </div>
                            <div class="deep-font mg4">产品品种：</div>
                            <div class="content-font mg16">{{ state.factoryData?.operateProducctVariety }}</div>
                            <div class="deep-font mg4">特殊要求（品质等）：</div>
                            <div class="content-font mg16">{{ state.factoryData?.operateSpecilalNeeds }}</div>
                            <div class="deep-font mg4">销售覆盖范围：</div>
                            <div class="content-font mg16">{{ state.factoryData?.operateSaleRange }}</div>
                        </div>
                        <!--                        经营信息-->
                        <!--                        生产类信息-->
                        <div v-if="state.innerRadio === '生产类信息'">
                            <div class="deep-font mg8">控制系统：</div>
                            <div class="mg16">
                                <div
                                    class="shareholder-item mg8 between"
                                    v-for="(controlItem, controlIndex) in state.factoryData?.controlSystemList"
                                >
                                    <div class="shareholder-left">
                                        <div class="deep-font">控制系统：</div>
                                        <div class="content-font">{{ controlItem.controlSystem }}</div>
                                    </div>
                                    <div class="shareholder-right">
                                        <div class="deep-font">系统厂家：</div>
                                        <div class="content-font">{{ controlItem.systemSource }}</div>
                                    </div>
                                    <div class="shareholder-right">
                                        <div class="deep-font">采购时间：</div>
                                        <div class="content-font">{{ controlItem.buyTime }}</div>
                                    </div>
                                    <div class="shareholder-right">
                                        <div class="deep-font">历史偏差率：</div>
                                        <div class="content-font">{{ controlItem.historyDeviation }}</div>
                                    </div>
                                </div>
                            </div>
                            <div class="deep-font mg8">自动化设备：</div>
                            <div class="mg16">
                                <div
                                    class="shareholder-item mg8 between"
                                    v-for="(autoItem, autoIndex) in state.factoryData?.automationDeviceList"
                                >
                                    <div class="shareholder-left">
                                        <div class="deep-font">设备类型：</div>
                                        <div class="content-font">{{ autoItem.productionDeviceName }}</div>
                                    </div>
                                    <div class="shareholder-right">
                                        <div class="deep-font">设备厂家：</div>
                                        <div class="content-font">{{ autoItem.deviceManufacturerName }}</div>
                                    </div>
                                    <div class="shareholder-right">
                                        <div class="deep-font">采购时间：</div>
                                        <div class="content-font">{{ autoItem.buyTime }}</div>
                                    </div>
                                    <div class="shareholder-right">
                                        <div class="deep-font">历史偏差率：</div>
                                        <div class="content-font">{{ autoItem.historyDeviation }}</div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--                        生产类信息-->
                        <!--                        信息化信息-->
                        <div v-if="state.innerRadio === '信息化信息'">
                            <div class="top-count mg16">
                                <div class="count-item">
                                    <div class="deep-font">企业在用信息化系统数量</div>
                                    <div class="count-font">
                                        <span class="count-font-deep">{{
                                            state.factoryData?.informationSystemNumber
                                        }}</span>
                                        <span class="count-font-light">个</span>
                                    </div>
                                    <div class="count-border"></div>
                                </div>
                                <div class="count-item">
                                    <div class="deep-font">企业近3年申报信息化奖项数量</div>
                                    <div class="count-font">
                                        <span class="count-font-deep">{{
                                            state.factoryData?.informationRewardNumber
                                        }}</span>
                                        <span class="count-font-light">个</span>
                                    </div>
                                    <div class="count-border"></div>
                                </div>
                                <div class="count-item">
                                    <div class="deep-font">企业近3年申请专利软抓数量</div>
                                    <div class="count-font">
                                        <span class="count-font-deep">{{
                                            state.factoryData?.informationSoftwareNumber
                                        }}</span>
                                        <span class="count-font-light">个</span>
                                    </div>
                                    <div class="count-border"></div>
                                </div>
                                <div class="count-item">
                                    <div class="deep-font">企业近3年合作数智化公司数量</div>
                                    <div class="count-font">
                                        <span class="count-font-deep">{{
                                            state.factoryData?.informationCooperateDigitalCompanyNumber
                                        }}</span>
                                        <span class="count-font-light">个</span>
                                    </div>
                                    <div class="count-border"></div>
                                </div>
                                <div class="count-item">
                                    <div class="deep-font">企业近3年投入信息化建设资金金额</div>
                                    <div class="count-font">
                                        <span class="count-font-deep">{{
                                            state.factoryData?.informationEnterpriseDigitalInvestAmount
                                        }}</span>
                                        <span class="count-font-light">个</span>
                                    </div>
                                </div>
                            </div>
                            <div class="deep-font mg8">软件系统采购：</div>
                            <div class="mg16">
                                <div
                                    class="shareholder-item mg8 gap72"
                                    v-for="(softItem, softIndex) in state.factoryData?.softwareBuyList"
                                >
                                    <div class="shareholder-left">
                                        <div class="deep-font">软件系统类型：</div>
                                        <div class="content-font">{{ softItem.softwareSystemCategory }}</div>
                                    </div>
                                    <div class="shareholder-right">
                                        <div class="deep-font">软件系统采购时间：</div>
                                        <div class="content-font">{{ softItem.softwareSystemBuyTime }}</div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--                        信息化信息-->
                        <!--                        决策信息-->
                        <div v-if="state.innerRadio === '决策信息'">
                            <div class="deep-font mg8">决策层级：</div>
                            <div class="mg16">
                                <div
                                    class="shareholder-item mg8 gap72"
                                    v-for="(decisionItem, decisionIndex) in state.factoryData?.decisionLevelList"
                                >
                                    <div class="shareholder-left">
                                        <div class="deep-font">阶段：</div>
                                        <div class="content-font">{{ decisionItem.stage }}</div>
                                    </div>
                                    <div class="shareholder-right">
                                        <div class="deep-font">最高层级：</div>
                                        <div class="content-font">{{ decisionItem.highLevel }}</div>
                                    </div>
                                </div>
                            </div>
                            <div class="deep-font mg4">决策影响因素：</div>
                            <div class="content-font mg16">{{ state.factoryData?.decisionMakingEffectFactor }}</div>
                            <div class="deep-font mg4">风险规避倾向：</div>
                            <div class="content-font mg16">{{
                                state.factoryData?.decisionMakingRiskAvoidWindDirection
                            }}</div>
                            <div class="deep-font mg4">特殊情况：</div>
                            <div class="content-font mg16">{{ state.factoryData?.decisionMakingSpecialSituation }}</div>
                        </div>
                        <!--                        决策信息-->
                    </div>
                    <!--                    底部信息-->
                </div>
                <div class="content" v-if="state.activeKey === '年度政策'">
                    <div class="main year-main">
                        <a-form :model="state.factoryData" ref="yearRef">
                            <div class="base-msg deep-font mg8"> 方案基调 </div>
                            <div class="year-content mg12" v-if="!state.yearIsEdit">
                                {{ state.factoryData.yearPolicyPolicyTone }}
                            </div>
                            <a-form-item
                                label=""
                                v-if="state.yearIsEdit"
                                :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                name="yearPolicyPolicyTone"
                            >
                                <a-textarea
                                    :placeholder="inputHolder"
                                    v-model:value="state.factoryData.yearPolicyPolicyTone"
                                />
                            </a-form-item>
                            <div class="base-msg deep-font mg8"> 激励机制 </div>
                            <div class="year-content mg12" v-if="!state.yearIsEdit">
                                {{ state.factoryData.yearPolicyExcitationMechanism }}
                            </div>
                            <a-form-item
                                label=""
                                v-if="state.yearIsEdit"
                                :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                name="yearPolicyExcitationMechanism"
                            >
                                <a-textarea
                                    :placeholder="inputHolder"
                                    v-model:value="state.factoryData.yearPolicyExcitationMechanism"
                                />
                            </a-form-item>
                            <div class="base-msg deep-font mg8"> 年度数智化建设预算 </div>
                            <div class="year-content mg12 year-deep-font" v-if="!state.yearIsEdit">
                                {{ state.factoryData.yearPolicyDigitalConstructionBudget }}</div
                            >
                            <a-form-item
                                label=""
                                v-if="state.yearIsEdit"
                                :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                name="yearPolicyDigitalConstructionBudget"
                            >
                                <a-textarea
                                    :placeholder="inputHolder"
                                    v-model:value="state.factoryData.yearPolicyDigitalConstructionBudget"
                                />
                            </a-form-item>
                            <div class="base-msg deep-font mg8"> 判断政策导向对于信息化企业的态度和阻碍 </div>
                            <div class="year-content mg12" v-if="!state.yearIsEdit">
                                {{ state.factoryData.yearPolicyImpede }}
                            </div>
                            <a-form-item
                                label=""
                                v-if="state.yearIsEdit"
                                :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
                                name="yearPolicyImpede"
                            >
                                <a-textarea
                                    :placeholder="inputHolder"
                                    v-model:value="state.factoryData.yearPolicyImpede"
                                />
                            </a-form-item>
                        </a-form>
                    </div>
                    <div class="bottom-btn">
                        <a-button type="primary" @click="checkYear" :loading="state.yearLoading">{{
                            state.yearIsEdit ? '提交年度政策' : '编辑'
                        }}</a-button>
                    </div>
                </div>
                <div class="content" v-if="state.activeKey === '人物画像'">
                    <div class="main">
                        <div
                            class="base-table"
                            :style="{
                                marginTop: state.baseIsEdit ? '0' : '16px'
                            }"
                        >
                            <a-table :columns="peopleColumns" :data-source="state.peopleData" :pagination="false">
                                <template #bodyCell="{ column, record, text }">
                                    <template v-if="column.dataIndex === 'opration'">
                                        <a-button
                                            type="link"
                                            @click="jumpPeople(record.id, state.detailId, 'factory', 'detail')"
                                            >查看
                                        </a-button>
                                        <a-popconfirm
                                            title="确定删除吗?"
                                            ok-text="确定"
                                            cancel-text="取消"
                                            @confirm="handleDeletePeople(record.id)"
                                            @cancel="cancel"
                                        >
                                            <a-button type="link">删除 </a-button>
                                        </a-popconfirm>
                                    </template>
                                </template>
                            </a-table>
                        </div>
                    </div>
                    <div class="bottom-btn">
                        <a-button type="primary" @click="jumpPeople(null, state.detailId, 'factory', 'add')"
                            >新建角色</a-button
                        >
                    </div>
                </div>
                <div class="content" v-if="state.activeKey === '客户画像'">
                    <div class="main year-main">
                        <div class="tip mg16 has-btn" style="align-items: start">
                            <div> 客户画像详情 </div>
                            <a-button type="primary" size="small" @click="showEdit('客户画像')">
                                <template #icon><EditOutlined /></template>
                                编辑</a-button
                            >
                        </div>
                        <div class="custom-container">
                            <!-- 顶部卡片 -->
                            <div class="custom-top">
                                <div class="custom-item">
                                    <div class="item-left">
                                        <div class="long-icon"></div>
                                    </div>
                                    <div class="item-right">
                                        <div class="deep-font">工厂全称</div>
                                        <div class="light-font"></div>
                                    </div>
                                </div>
                                <div class="custom-item">
                                    <div class="item-left">
                                        <div class="short-icon"></div>
                                    </div>
                                    <div class="item-right">
                                        <div class="deep-font">工厂简称</div>
                                        <div class="light-font"></div>
                                    </div>
                                </div>
                                <div class="custom-item">
                                    <div class="item-left">
                                        <div class="leader-icon"></div>
                                    </div>
                                    <div class="item-right">
                                        <div class="deep-font">客成经理</div>
                                        <div class="light-font"></div>
                                    </div>
                                </div>
                            </div>

                            <!-- 底部区域 -->
                            <div class="custom-bottom">
                                <div class="bottom-left">
                                    <div class="tip mg16">
                                        <div> 雷达分析 </div>
                                    </div>
                                </div>
                                <div class="bottom-right">
                                    <div class="tip mg16">
                                        <div> 企业数智化情况 </div>
                                    </div>
                                    <div class="deep-font mg4">企业拥抱数值化程度：</div>
                                    <div class="content-font mg24">企业拥抱数值化程度：</div>
                                    <div class="tip mg16">
                                        <div> 企业收益情况 </div>
                                    </div>
                                    <div class="deep-font mg4">企业效益支撑数智化程度：</div>
                                    <div class="content-font mg24">企业拥抱数值化程度：</div>
                                    <div class="tip mg16">
                                        <div> 客户等级 </div>
                                    </div>
                                    <div class="deep-font mg4">客户等级：</div>
                                    <div class="content-font mg24">B级：一般拥抱+完全支撑或可以支撑</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- end vid_7hclht4lf1 自定义模板_t9qsnxu55x -->
        </a-spin>
    </div>
</template>
<script setup lang="tsx">
    import {
        h,
        ref,
        reactive,
        toRaw,
        markRaw,
        watch,
        computed,
        onBeforeMount,
        onMounted,
        onBeforeUnmount,
        onUnmounted,
        onActivated,
        onDeactivated
    } from 'vue'
    import { useRoute, useRouter } from 'vue-router'
    const router = useRouter()
    const route = useRoute()
    import { get, post, put, del, request, requestWithHeaders } from '@/utils/http/Axios'
    import {
        cloneDeep,
        localGet,
        merge,
        getDifferenceArray,
        traversalTreeStructure,
        checkCaseCondition,
        renderStringInTemplate,
        handleBreadcrumbJump,
        throttle,
        permission,
        getComponentParamsValue
    } from '@/utils/index'
    import { isNullOrEmpty, isEmptyArr, isNullOrUnDef, isContained, isArray, isEmpty, isObject } from '@/utils/is'
    import dayjs from 'dayjs'
    import { getPagePcChartsDataSourceConvert } from '@/utils/chart'
    import { message, notification, Modal } from 'ant-design-vue'
    import {
        propertyFormatByNumber,
        propertyFormatByPercentage,
        propertyFormatByDate,
        parseSubFromDataList
    } from '@/utils/format'
    import colorTheme from '@/design/custom-theme.json'
    import { includes } from 'lodash-es'
    /*** PUBLISH_EXEGESIS ***
 import UserTableRecords from '@/model/UserTableRecords';
 import { getAppBaseUrl } from '@/utils/index';
 import { sendToken } from "@/hooks/useIframeToken";
 import { useSystemStore } from "@/store/modules/system";
 const systemStore = useSystemStore();
 *** PUBLISH_EXEGESIS ***/

    // 获取传入的流程ID和组件参数
    const props = defineProps({
        'processInstanceId': {
            type: [String, Number, Boolean],
            default: undefined
        }
    })
    const immediateWatch = (source, callback) => {
        watch(source, callback, { deep: true, immediate: true })
    }

    /* -------------------------- 属性定义 -------------------------- */

    const setTimeOutList = []
    const pageLoading = reactive({
        loading: false,
        tip: undefined
    })
    const authInfo = localGet('app-user-store')

    // 处理校验
    const setSubFormName = (parentInfo, name) => {
        return [parentInfo.parents, parentInfo.cycleIndex, name]
    }

    /* ========================== 属性定义 ========================== */

    /* -------------------------- 元素数据引用 -------------------------- */

    /* ========================== 元素数据引用 ========================== */

    /* -------------------------- 页面数据 -------------------------- */

    /* ========================== 页面数据 ========================== */

    /* -------------------------- 响应 -------------------------- */

    /* ========================== 响应 ========================== */

    /* -------------------------- 函数 -------------------------- */

    /* ========================== 函数 ========================== */

    /* -------------------------- 页面参数 -------------------------- */

    const pageParameter_state = reactive({
        'processInstanceId': props.processInstanceId ?? route.query.processInstanceId
    })

    /* ========================== 页面参数 ========================== */

    /* -------------------------- 组件事件处理方法 -------------------------- */

    // ---------------------------- 组件数据同步 ----------------------------

    // ============================ 组件数据同步 ============================

    /* ========================== 组件事件处理方法 ========================== */

    /* -------------------------- 生命周期 -------------------------- */
    // 用于参数变更后重新执行自定义指令
    const queryUpdateFlag = ref(0)
    onMounted(() => {})

    onUnmounted(() => {
        // 销毁定时器
        setTimeOutList.forEach(({ repeat, timer }) => {
            repeat ? clearInterval(timer) : clearTimeout(timer)
        })
    })

    /* ========================== 生命周期 ========================== */

    /* -------------------------- 数据关联处理 -------------------------- */

    /* -------------------------- 表单数据同步 -------------------------- */
    /* ========================== 表单数据同步 ========================== */

    /* ========================== 数据关联处理 ========================== */

    /* -------------------------- 不同组件自定义的处理逻辑 -------------------------- */

    /* ========================== 不同组件自定义的处理逻辑 ========================== */

    // ================================定制化逻辑========================================
    onMounted(() => {
        const urlParams = new URLSearchParams(window.location.search)

        // 获取单个参数
        state.detailId = urlParams?.get('factoryId')
        state.type = urlParams?.get('type')
        state.areaId = urlParams?.get('areaId')
        if (state.type == 'detail') {
            getBaseData()
            console.log('查看')
        } else {
            console.log('新建')
        }
        loadAllDictionaries()
        getAllUser()
    })
    const inputHolder = '请输入'
    const selectHolder = '请选择'
    const state = reactive({
        activeKey: '客户画像',
        innerRadio: '信息化信息',
        detailId: undefined,
        areaId: undefined,
        type: undefined,
        baseIsEdit: false,
        submitLoading: false,
        yearIsEdit: false,
        yearLoading: false,
        baseLoading: false,
        peopleIsEdit: false,
        informationEditVisible: false,
        informationEditTitle: '',
        editType: '',
        baseData: {},
        customData: {},
        peopleData: [],
        allUser: [],
        factoryData: {
            productLineList: [],
            shareholderList: [],
            mainBusinessList: [],
            operateList: [],
            'controlSystemList': [],
            'automationDeviceList': [],
            'softwareBuyList': [],
            'decisionLevelList': [],
            capacityMetricsList: []
        },
        modalForm: {},
        //     企业性质
        xzList: [],
        //     企业位置
        wzList: [
            {
                'label': '北京',
                'value': '北京',
                'children': [
                    {
                        'label': '东城区',
                        'value': '东城区'
                    },
                    {
                        'label': '西城区',
                        'value': '西城区'
                    },
                    {
                        'label': '朝阳区',
                        'value': '朝阳区'
                    }
                ]
            },
            {
                'label': '上海',
                'value': '上海',
                'children': [
                    {
                        'label': '黄浦区',
                        'value': '黄浦区'
                    },
                    {
                        'label': '徐汇区',
                        'value': '徐汇区'
                    },
                    {
                        'label': '浦东新区',
                        'value': '浦东新区'
                    }
                ]
            },
            {
                'label': '天津',
                'value': '天津',
                'children': [
                    {
                        'label': '和平区',
                        'value': '和平区'
                    },
                    {
                        'label': '河西区',
                        'value': '河西区'
                    },
                    {
                        'label': '南开区',
                        'value': '南开区'
                    }
                ]
            },
            {
                'label': '重庆',
                'value': '重庆',
                'children': [
                    {
                        'label': '渝中区',
                        'value': '渝中区'
                    },
                    {
                        'label': '江北区',
                        'value': '江北区'
                    },
                    {
                        'label': '南岸区',
                        'value': '南岸区'
                    }
                ]
            },
            {
                'label': '广东',
                'value': '广东',
                'children': [
                    {
                        'label': '广州',
                        'value': '广州'
                    },
                    {
                        'label': '深圳',
                        'value': '深圳'
                    },
                    {
                        'label': '佛山',
                        'value': '佛山'
                    },
                    {
                        'label': '珠海',
                        'value': '珠海'
                    }
                ]
            },
            {
                'label': '江苏',
                'value': '江苏',
                'children': [
                    {
                        'label': '南京',
                        'value': '南京'
                    },
                    {
                        'label': '苏州',
                        'value': '苏州'
                    },
                    {
                        'label': '无锡',
                        'value': '无锡'
                    }
                ]
            },
            {
                'label': '浙江',
                'value': '浙江',
                'children': [
                    {
                        'label': '杭州',
                        'value': '杭州'
                    },
                    {
                        'label': '宁波',
                        'value': '宁波'
                    },
                    {
                        'label': '温州',
                        'value': '温州'
                    }
                ]
            },
            {
                'label': '山东',
                'value': '山东',
                'children': [
                    {
                        'label': '济南',
                        'value': '济南'
                    },
                    {
                        'label': '青岛',
                        'value': '青岛'
                    },
                    {
                        'label': '烟台',
                        'value': '烟台'
                    }
                ]
            },
            {
                'label': '四川',
                'value': '四川',
                'children': [
                    {
                        'label': '成都',
                        'value': '成都'
                    },
                    {
                        'label': '绵阳',
                        'value': '绵阳'
                    },
                    {
                        'label': '德阳',
                        'value': '德阳'
                    }
                ]
            },
            {
                'label': '湖北',
                'value': '湖北',
                'children': [
                    {
                        'label': '武汉',
                        'value': '武汉'
                    },
                    {
                        'label': '宜昌',
                        'value': '宜昌'
                    },
                    {
                        'label': '襄阳',
                        'value': '襄阳'
                    }
                ]
            },
            {
                'label': '湖南',
                'value': '湖南',
                'children': [
                    {
                        'label': '长沙',
                        'value': '长沙'
                    },
                    {
                        'label': '株洲',
                        'value': '株洲'
                    },
                    {
                        'label': '湘潭',
                        'value': '湘潭'
                    }
                ]
            },
            {
                'label': '福建',
                'value': '福建',
                'children': [
                    {
                        'label': '福州',
                        'value': '福州'
                    },
                    {
                        'label': '厦门',
                        'value': '厦门'
                    },
                    {
                        'label': '泉州',
                        'value': '泉州'
                    }
                ]
            },
            {
                'label': '河北',
                'value': '河北',
                'children': [
                    {
                        'label': '石家庄',
                        'value': '石家庄'
                    },
                    {
                        'label': '唐山',
                        'value': '唐山'
                    },
                    {
                        'label': '保定',
                        'value': '保定'
                    }
                ]
            },
            {
                'label': '山西',
                'value': '山西',
                'children': [
                    {
                        'label': '太原',
                        'value': '太原'
                    },
                    {
                        'label': '大同',
                        'value': '大同'
                    },
                    {
                        'label': '临汾',
                        'value': '临汾'
                    }
                ]
            }
        ],
        //     企业级别
        jbList: [],
        csjbList: [],
        //     软件类型
        softList: [],
        productList: [],
        //     销售覆盖
        fgList: [],
        //     生产设备
        scsbList: [],
        //     阶段
        stageList: [],
        //     最高级别
        levelList: []
    })

    const peopleColumns = ref([
        {
            title: '姓名',
            align: 'center',
            dataIndex: 'userName',
            ellipsis: true
        },
        {
            title: '职务',
            align: 'center',
            dataIndex: 'userPosition',
            ellipsis: true
        },
        {
            title: '职能与权限',
            align: 'center',
            dataIndex: 'userFunction',
            ellipsis: true
        },
        {
            title: '掌握核心决策人其权限',
            align: 'center',
            dataIndex: 'userCoreDecisionMakers',
            ellipsis: true
        },
        {
            title: '操作',
            align: 'center',
            dataIndex: 'opration',
            ellipsis: true
        }
    ])
    function tabChange() {
        if (state.activeKey === '人物画像') {
            if (state.type === 'detail') {
                getPeopleData()
            }
        } else if (state.activeKey === '客户画像') {
            getCustomData()
        } else {
            if (state.type === 'detail') {
                getBaseData()
            }
        }
    }
    function getAllUser() {
        get('/solution-ppm/api/v2/built-in-system-ppm/pmgf/get/allUser').then(data => {
            if (data.code !== 200) {
                message.error(data.message)
                return
            }
            state.allUser = data.data.userDtoList
        })
    }
    // 获取年度政策/企业画像
    function getBaseData() {
        get(`/solution-ppm/api/v2/built-in-system-ppm/customer_area_factory/${state.detailId}`).then(data => {
            if (data.code !== 200) {
                message.error(data.message)
                state.factoryData = {}
                return
            }
            state.factoryData = data.data
            // state.factoryData.productLineList = state.factoryData.productLineList.map(item => {
            //     return {
            //         key: item,
            //         value: item
            //     }
            // })
        })
    }
    // 获取人物画像
    function getPeopleData() {
        post('/solution-ppm/api/v2/built-in-system-ppm/customer_area_factory_user_portrait/search', {
            'orderBy': 'id',
            'distinct': false,
            'conditions': [
                {
                    'field': 'factory_id',
                    'operator': 'EQ',
                    'value': state.detailId,
                    'secondValue': {},
                    'valueType': 'NUMBER'
                }
            ],
            'pageNumber': 1,
            'pageSize': 1000
        }).then(data => {
            if (data.code !== 200) {
                message.error(data.message)
                state.peopleData = {}
                return
            }
            state.peopleData = data.data
        })
    }
    // 获取客户画像
    function getCustomData() {
        get(
            `/solution-ppm/api/v2/built-in-system-ppm/customer_area_factory_customer_portrait/factory/${state.detailId}`,
            {}
        ).then(data => {
            state.customData = data.data
        })
    }
    function jumpPeople(id, factoryId, source, type) {
        if (!factoryId) {
            message.info('请先保存企业画像')
            return
        }
        window.open(
            `${import.meta.env.VITE_PUBLIC_PATH}/page/3000001064?id=${
                id ? id : ''
            }&areaId=${factoryId}&source=${source}&type=${type}`,
            '_blank'
        )
    }
    //     编辑/提交年度政策
    const yearRef = ref(null)

    function checkYear() {
        if (state.yearIsEdit) {
            yearRef.value.validate().then(() => {
                state.yearLoading = true
                const api = state.type === 'add' ? post : put
                api(
                    `/solution-ppm/api/v2/built-in-system-ppm/customer_area_factory/${
                        state.detailId ? state.detailId : ''
                    }`,
                    {
                        ...state.factoryData,
                        delFlag: 0,
                        areaId: state.areaId
                    }
                )
                    .then(data => {
                        if (data.code !== 200) {
                            message.error(data.message)
                            return
                        }
                        message.success(data.message)
                        state.yearIsEdit = false
                        if (state.type === 'add') {
                            Object.assign(state.factoryData, data.data)
                            state.detailId = data.data.id
                            state.type = 'detail'
                            window.history.replaceState(
                                {},
                                '',
                                `?factoryId=${state.detailId}&areaId=${state.areaId}&type=detail`
                            )
                        } else {
                            getBaseData()
                        }
                        state.informationEditVisible = false
                    })
                    .finally(() => {
                        state.yearLoading = false
                    })
            })
        } else {
            state.yearIsEdit = true
        }
    }
    function checkEdit() {
        if (state.innerRadio === '基本信息') {
            showEdit('基础信息')
        } else if (state.innerRadio === '经营信息') {
            showEdit('经营信息')
        } else if (state.innerRadio === '生产类信息') {
            showEdit('生产类信息')
        } else if (state.innerRadio === '信息化信息') {
            showEdit('信息化信息')
        } else {
            showEdit('决策信息')
        }
    }
    function showEdit(type) {
        state.editType = type
        let record = cloneDeep(state.factoryData)
        Object.assign(state.modalForm, record)
        state.informationEditVisible = true
    }
    // 生产线
    function handleAddProductLine() {
        state.modalForm.productLineList.push('')
    }
    function handleDeleteProductLine(index) {
        state.modalForm.productLineList.splice(index, 1)
    }
    // 股东信息
    function handleAddShareholde() {
        state.modalForm.shareholderList.push({
            'name': undefined,
            'proportion': undefined
        })
    }
    function handleDeleteShareholde(index) {
        state.modalForm.shareholderList.splice(index, 1)
    }
    // 软件信息
    function handleAddSoft() {
        state.modalForm.softwareBuyList.push({
            'softwareSystemCategory': undefined,
            'softwareSystemBuyTime': undefined
        })
    }
    function handleDeleteSoft(index) {
        state.modalForm.softwareBuyList.splice(index, 1)
    }
    // 主营产品
    function handleAddOperate() {
        state.modalForm.operateProductsProportionList.push({
            'productName': undefined,
            'ratio': undefined
        })
    }
    function handleDeleteOperate(index) {
        state.modalForm.operateProductsProportionList.splice(index, 1)
    }
    // 经营指标
    function handleAddMetrics() {
        state.modalForm.operateOperateMetricsList.push({
            'income': undefined,
            'grossMargin': undefined,
            'areaMarketRank': undefined
        })
    }
    function handleDeleteMetrics(index) {
        state.modalForm.operateOperateMetricsList.splice(index, 1)
    }
    // 控制系统
    function handleAddControl() {
        state.modalForm.controlSystemList.push({
            'controlSystem': undefined,
            'systemSource': undefined,
            'historyDeviation': undefined,
            'buyTime': undefined
        })
    }
    function handleDeleteControl(index) {
        state.modalForm.controlSystemList.splice(index, 1)
    }
    // 自动化设备
    function handleAddAuto() {
        state.modalForm.automationDeviceList.push({
            'productionDeviceName': undefined,
            'deviceManufacturerName': undefined,
            'buyTime': undefined,
            'historyDeviation': undefined
        })
    }
    function handleDeleteAuto(index) {
        state.modalForm.automationDeviceList.splice(index, 1)
    }
    // 决策
    function handleAddDecision() {
        state.modalForm.decisionLevelList.push({
            'stage': undefined,
            'highLevel': undefined
        })
    }
    function handleDeleteDecision(index) {
        state.modalForm.decisionLevelList.splice(index, 1)
    }
    // 父上传文件
    function handlerUpload(file) {
        const isImage = file.type.startsWith('image/')
        if (!isImage) {
            message.error('只允许上传图片文件')
            return false
        }
        const data = new FormData()
        data.append('file', file)

        post('/file-storage/api/v1/file/upload', data)
            .then(({ data: { fullUrl } }) => {
                if (data) {
                    // 新文件对象
                    const newFile = {
                        uid: file.uid,
                        lastModified: file.lastModified,
                        name: file.name,
                        size: file.size,
                        type: file.type,
                        status: 'done',
                        url: fullUrl
                    }

                    // 去重，保留一个副本
                    state.modalForm.departmentImageList = [
                        // 保留已存在文件（去除重复）
                        ...state.modalForm.departmentImageList.filter(
                            item => item.uid !== file.uid && item.name !== file.name
                        ),
                        // 添加新的文件
                        newFile
                    ]
                }
            })
            .catch(e => {
                message.error('上传失败' + e)
            })

        return false
    }
    // 父移除文件
    function handlerRemove(file) {
        state.modalForm.departmentImageList = state.modalForm.departmentImageList.filter(item => item.uid !== file.uid)
    }
    function cancelDrawer() {
        state.informationEditVisible = false
    }
    const dictMap = {
        jbList: 'CUSTOMER.AREA.ENTERPRICE.LEVEL',
        xzList: 'CUSTOMER.AREA.ENTERPRICE.NATURE',
        csjbList: 'CUSTOMER.AREA.CITY',
        softList: 'CUSTOMER.AREA.SOFTWARE-SYSTEM-TYPE',
        productList: 'CUSTOMER.AREA.ZYCP',
        fgList: 'CUSTOMER.AREA.XSFW',
        scsbList: 'CUSTOMER.AREA.ZDHSB',
        stageList: 'CUSTOMER.AREA.DECISION.LEVEL',
        levelList: 'CUSTOMER.AREA.MAX.LEVEL'
    }
    function loadAllDictionaries() {
        Object.entries(dictMap).forEach(([key, apiKey]) => {
            fetchDictionary(apiKey, key as keyof typeof state)
        })
    }
    function fetchDictionary(apiKey, target: keyof typeof state) {
        get(`/solution-ppm/api/v2/built-in-system-ppm/dictionary/search/${apiKey}`).then(data => {
            if (data.code !== 200) {
                message.error(data.message)
                return
            }
            state[target] = data.data.map(item => ({
                label: item.itemName,
                value: item.itemName
            }))
        })
    }
    const formRef = ref(null)
    function handleSubmitFactory() {
        formRef.value.validate().then(() => {
            const api = state.type === 'add' ? post : put
            state.submitLoading = true
            api(`/solution-ppm/api/v2/built-in-system-ppm/customer_area_factory/${state.detailId}`, state.modalForm)
                .then(data => {
                    if (data.code !== 200) {
                        message.error(data.message)
                        return
                    }
                    message.success(data.message)
                    state.yearIsEdit = false
                    if (state.type === 'add') {
                        Object.assign(state.factoryData, data.data)
                        state.detailId = data.data.id
                        state.type = 'detail'
                        window.history.replaceState(
                            {},
                            '',
                            `?factoryId=${state.detailId}&areaId=${state.areaId}&type=detail`
                        )
                    } else {
                        getBaseData()
                    }
                })
                .finally(() => {
                    state.submitLoading = false
                })
        })
    }
    const customRef = ref(null)
    function handleSubmitCustom() {
        formRef.value.validate().then(() => {
            const api = state.type === 'add' ? post : put
            state.submitLoading = true
            api(
                `/built-in-system-ppm/customer_area_factory_customer_portrait/factory/${state.detailId}`,
                state.customData
            )
                .then(data => {
                    if (data.code !== 200) {
                        message.error(data.message)
                        return
                    }
                    message.success(data.message)
                    state.yearIsEdit = false
                    if (state.type === 'add') {
                        Object.assign(state.factoryData, data.data)
                        state.detailId = data.data.id
                        state.type = 'detail'
                        window.history.replaceState(
                            {},
                            '',
                            `?factoryId=${state.detailId}&areaId=${state.areaId}&type=detail`
                        )
                    } else {
                        getBaseData()
                    }
                })
                .finally(() => {
                    state.submitLoading = false
                })
        })
    }
    function validatePositiveInteger(rule, value) {
        if (!value) return Promise.reject('请输入')
        const reg = /^[1-9]\d*$/
        if (!reg.test(value)) {
            return Promise.reject('请输入正整数')
        }
        return Promise.resolve()
    }
</script>
<style lang="less" scoped>
    .page_root {
        width: 100%;
        height: 100%;
        overflow: hidden;
    }
    .page_root :deep(.@{ant-prefix}-spin-nested-loading),
    .page_root :deep(.@{ant-prefix}-spin-container) {
        height: 100%;
    }
    .page_root :deep(.@{ant-prefix}-spin-container .@{ant-prefix}-table-wrapper) {
        display: flex;
        flex-flow: column nowrap;
        justify-content: flex-start;
    }
    .page_root :deep(.@{ant-prefix}-table) {
        flex: auto;
        overflow: auto;
    }
    .table-moreBtn_down {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        width: 100px;
    }

    .table-moreBtn_menu :deep(.table-moreBtn_menu-item):hover {
        background: #ebf1ff;
    }

    /*  表格树结构样式处理，展开按钮层级增加*/
    :deep(.@{ant-prefix}-table-row-expand-icon) {
        z-index: 1;
    }
    /*  表格树结构 由于每个表格项采用自定义组件，使用绝对定位布局，开启树结构导致显示异常，暂时使用层级定位位置 */
    :deep(.@{ant-prefix}-table-row-level-1 .@{ant-prefix}-table-cell-with-append .cell-wrapper-left) {
        left: 15px !important;
        width: calc(100% - 15px);
    }
    :deep(.@{ant-prefix}-table-row-level-2 .@{ant-prefix}-table-cell-with-append .cell-wrapper-left) {
        left: 30px !important;
        width: calc(100% - 30px);
    }
    :deep(.@{ant-prefix}-table-row-level-3 .@{ant-prefix}-table-cell-with-append .cell-wrapper-left) {
        left: 45px !important;
        width: calc(100% - 45px);
    }
    :deep(.@{ant-prefix}-table-row-level-4 .@{ant-prefix}-table-cell-with-append .cell-wrapper-left) {
        left: 60px !important;
        width: calc(100% - 60px);
    }

    /* 穿梭框改变默认样式，为根据组件样式控制左右栏宽度。 */
    :deep(.@{ant-prefix}-transfer-list) {
        height: 100%;
        width: 50%;
    }
    /*样式*/
    .body {
        height: calc(100% - 50px);
        overflow-y: auto;
        border-radius: 4px;
    }

    .content {
        height: 100%;
        padding: 24px;
        background-color: #fff;
        display: flex;
        flex-direction: column;
    }

    .main {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
    }
    .drawer-body:deep(.ant3-picker) {
        width: 100%;
    }
    .drawer-body:deep(.ant3-input-number) {
        width: 100%;
    }
    .drawer-body {
        display: flex;
        flex-direction: column;
        height: 100%;
    }
    .drawer-main {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
    }
    .bottom-btn {
        height: 76px;
        flex-shrink: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        border-top: 1px solid #f0f0f0; /* 可选的分隔线 */
        background-color: #fff; /* 确保按钮不被内容遮挡 */
        z-index: 10; /* 若上面有浮层可适当加 */
    }
    .base-msg {
        height: 14px;
        line-height: 14px;
        border-left: 2px solid #3875ff;
        padding-left: 6px;
        display: flex;
        gap: 40px;
    }
    .tip-div {
        height: 14px;
        width: 2px;
        background-color: #3875ff;
    }
    .light-font {
        font-size: 14px;
        color: #595959;
        letter-spacing: 0;
        font-weight: 400;
    }
    .content-font {
        font-size: 14px;
        color: #262626;
        letter-spacing: 0;
        font-weight: 400;
    }
    .deep-font {
        font-size: 14px;
        color: #262626;
        letter-spacing: 0;
        font-weight: 600;
    }

    .base-table:deep(.@{ant-prefix}-table-thead) > tr > th {
        background: #f5f8ff;
        color: #262626;
        font-weight: 600;
        padding: 10px 16px;
        border-right: 1px solid #d9d9d9 !important;
        position: relative;
    }
    .base-table :deep(.@{ant-prefix}-table-tbody) tr > td {
        font-size: 14px;
        font-family: arial, helvetica, 'microsoft yahei';
        font-weight: 400;
        color: #262626;
        border-bottom: 1px solid #d9d9d9;
        padding: 0 5px;
        word-break: break-all;
    }
    .year-main :deep(.ant3-form-item-required::before) {
        display: none !important;
    }
    .mg8 {
        margin-bottom: 8px;
    }
    .mg12 {
        margin-bottom: 12px;
    }
    .year-main :deep(.ant3-input) {
        min-height: 64px;
    }
    .year-content {
        font-size: 14px;
        color: #262626;
        letter-spacing: 0;
        font-weight: 400;
    }
    .year-deep-font {
        font-weight: 600;
    }
    .tab-body {
        border-bottom: 1px solid #d9d9d9;
        margin-bottom: 16px;
    }
    .tab-body :deep(.ant3-tabs-nav) {
        margin-bottom: 0;
    }
    .tip {
        height: 16px;
        line-height: 16px;
        padding-left: 8px;
        border-left: 4px solid #3875ff;
        font-size: 16px;
        color: #000000;
        letter-spacing: 0;
        font-weight: 600;
    }
    .has-btn {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .mg16 {
        margin-bottom: 16px;
    }
    .mg4 {
        margin-bottom: 4px;
    }
    .information-table {
        margin-top: 23px;
        border: 1px solid #d9d9d9;
        border-radius: 4px;
    }
    .one-line,
    .four-line {
        height: 40px;
        display: flex;
        line-height: 40px;
    }
    .four-line {
        border-top: 1px solid #d9d9d9;
        border-bottom: 1px solid #d9d9d9;
    }
    .table-title {
        font-size: 14px;
        color: #595959;
        letter-spacing: 0;
        text-align: right;
        font-weight: 400;
        width: 122px;
        text-align: right;
        line-height: 24px;
        padding: 8px 16px;
        border-right: 1px solid #d9d9d9;
        flex-shrink: 0; /* 不允许压缩 */
        background: #f5f8ff;
        border-radius: 4px 0 0 0;
    }
    .table-content-one,
    .table-content-four {
        padding: 10px 17px;
        font-size: 14px;
        color: #262626;
        letter-spacing: 0;
        font-weight: 500;
        line-height: 20px;
    }
    .middle {
        border-left: 1px solid #d9d9d9;
    }
    .table-content-four {
        flex: 1;
        text-overflow: ellipsis; /* 如果内容过长显示省略号 */
        overflow: hidden;
        white-space: nowrap;
    }
    /*生产线*/
    .production-line-item {
        padding: 12px 16px;
        background-image: linear-gradient(270deg, rgba(56, 117, 255, 0.05) 0%, rgba(56, 117, 255, 0.1) 100%);
        border-radius: 4px;
    }
    /*生产线*/
    .radio-body :deep(.ant3-radio-button-wrapper-checked) {
        background: rgba(56, 117, 255, 0.1);
    }
    /*股东*/
    .shareholder-item {
        display: flex;
        padding: 12px 16px;
        background-image: linear-gradient(270deg, rgba(56, 117, 255, 0.05) 0%, rgba(56, 117, 255, 0.1) 100%);
        border-radius: 4px;
    }
    /*股东*/
    .shareholder-left,
    .shareholder-right {
        display: flex;
    }
    .gap72 {
        gap: 72px;
    }
    .gap200 {
        gap: 200px;
    }
    .gap260 {
        gap: 260px;
    }
    .between {
        justify-content: space-between;
    }
    .count-font-deep {
        font-size: 20px;
        color: #3875ff;
        letter-spacing: 0;
        font-weight: 600;
    }
    .count-font-light {
        font-size: 14px;
        color: #3875ff;
        letter-spacing: 0;
        font-weight: 400;
    }
    .top-count {
        display: flex;
        justify-content: space-between;
        padding: 26px 85px;
        background-image: linear-gradient(0deg, #f5f8ff 0%, #ffffff 63%);
        box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
        border-top: 1px solid #3875ff;
    }
    .count-item {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .count-border {
        position: absolute;
        width: 1px;
        height: 56px;
        background-image: linear-gradient(180deg, rgba(105, 173, 255, 0) 0%, #3875ff 49%, rgba(56, 117, 255, 0) 100%);
        right: -50%;
        top: 50%;
        transform: translateY(-50%);
    }
    .gray-bgc {
        background-color: #fafafa;
        padding-top: 16px;
        border-radius: 4px;
    }
    .bottom-tip {
        height: 14px;
        line-height: 14px;
        border-left: 2px solid #3875ff;
        padding-left: 6px;
        display: flex;
        gap: 40px;
    }
    .flex {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    .custom-item {
        padding: 16px;
        display: flex;
        gap: 16px;
        flex: 1;
        background-image: linear-gradient(270deg, rgba(56, 117, 255, 0.05) 0%, rgba(56, 117, 255, 0.1) 100%);
        border-radius: 4px;
    }
    .item-left {
        height: 48px;
        width: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #c0d3ff;
        border-radius: 4px;
    }
    .item-right {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .leader-icon,
    .long-icon,
    .short-icon {
        width: 24px;
        height: 24px;
        background-size: cover;
    }
    .custom-container {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }
    .custom-top {
        display: contents;
    }
    .long-icon {
        background-image: url('http://10.40.0.33:9001/file-storage/513124982570616832-source.png');
    }
    .leader-icon {
        background-image: url('http://10.40.0.33:9001/file-storage/513125712488564736-source.png');
    }
    .short-icon {
        background-image: url('http://10.40.0.33:9001/file-storage/513125663127898112-source.png');
    }
    .custom-bottom {
        display: contents;
    }

    .bottom-left {
        grid-column: 1; /* 对齐第一个 .custom-item */
        border-radius: 4px;
    }
    .mg24 {
        margin-bottom: 24px;
    }
    .bottom-right {
        grid-column: 2 / span 2; /* 占第2和第3列，对齐第二和第三 .custom-item */
        border-radius: 4px;
    }
</style>
